using System;
using System.Collections.Generic;



namespace ReportiFin
{
    public partial class FinIzvj : DevExpress.XtraReports.UI.XtraReport
    {

        class Holder
        {
           public Holder(Decimal Value)
            {
                _value = Value;
            }
            private Decimal _value;

            [System.ComponentModel.DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
            public Decimal Value
            {
                get { return _value; }
                set { _value = value;}
            }
        }
        String _format = "{0}-{1}-{2}-{3}";

        public FinIzvj()
        {
            InitializeComponent();
            object sender = new object();
         
            System.Collections.Generic.Dictionary<string, Holder> _dict = new System.Collections.Generic.Dictionary<string, Holder>();
           
            //string key = String.Format(_format, GetCurrentColumnValue("Godina"), GetCurrentColumnValue("Konto"),
            //                           GetCurrentColumnValue("IDKlijenta"), "1");
            //Decimal _decimal =  (Decimal)GetCurrentColumnValue("Iznos fakture");
            //if (_dict.ContainsKey(key))
            //{
            //    _dict[key].Value += _decimal;
            //}
            //else
            //{
            //    _dict.Add(key, new Holder(_decimal));

            //}

            DevExpress.XtraReports.UI.XRLabel _label = (DevExpress.XtraReports.UI.XRLabel) sender;
            
            string key = String.Format(_format, GetCurrentColumnValue("Godina"), GetCurrentColumnValue("Konto"),
                                      GetCurrentColumnValue("IDKlijenta"), "1");
            Holder _holder = new Holder(0);
            if (_dict.ContainsKey(key))
            {
                _dict[key].Value += 0;
            }
            else
            {

                _dict.Add(key, _holder);

                System.Windows.Forms.BindingSource _source = new System.Windows.Forms.BindingSource();
                _source.DataSource = _holder;
                _label.DataBindings.Add("Text", _holder, "Value");

            }
            Convert.ToDecimal(_label.Text);
            DevExpress.XtraEditors.XtraForm _form = new DevExpress.XtraEditors.XtraForm();
            _form.ShowDialog();
        }

        private void xrLabel2_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            System.Windows.Forms.MessageBox.Show(GetCurrentRow().GetType().ToString());


        }

    }
}
